﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Assignment3.Objects3D
{
    class FloorTile : SymmetricObject
    {
        public FloorTile(Vector3 size, Vector3 position)
            : base(new Vector3(size.X, size.Y, size.Z), position, 1, 2)
        {
        }

        public override void BuildShape()
        {
            Vector3[] faceVertices = new Vector3[4];
            faceVertices[0] = new Vector3(Size.X, 0, -Size.Z) + Position;
            faceVertices[1] = new Vector3(0, 0, -Size.Z) + Position;
            faceVertices[2] = Vector3.Zero + Position;
            faceVertices[3] = new Vector3(Size.X, 0, 0) + Position;

            Vector2[] textureVertices = new Vector2[4];
            textureVertices[0] = new Vector2(0, 0);
            textureVertices[1] = new Vector2(1, 0);
            textureVertices[2] = new Vector2(0, 1);
            textureVertices[3] = new Vector2(1, 1);

            Faces[0][0] = new VertexPositionNormalTexture(faceVertices[0], Vector3.UnitY, textureVertices[1]);
            Faces[0][1] = new VertexPositionNormalTexture(faceVertices[2], Vector3.UnitY, textureVertices[2]);
            Faces[0][2] = new VertexPositionNormalTexture(faceVertices[1], Vector3.UnitY, textureVertices[3]);
            Faces[0][3] = new VertexPositionNormalTexture(faceVertices[2], Vector3.UnitY, textureVertices[2]);
            Faces[0][4] = new VertexPositionNormalTexture(faceVertices[0], Vector3.UnitY, textureVertices[1]);
            Faces[0][5] = new VertexPositionNormalTexture(faceVertices[3], Vector3.UnitY, textureVertices[0]);
        }
    }
}
